SPB Git

spb/chat-spboucher Public

Private universal chat interface over the OpenRouter ecosystem — 400+ models, branching, streaming, usage tracking. Next.js 16 + SQLite, PWA, deployed on m4m64a at chat.spboucher.ai

TypeScript 78.8% CSS 15.1% JavaScript 4.9% Shell 1.2%
894 B · 25 lines typescript
Raw Blame History
1// Author: Simon-Pierre Boucher2// Contact: contact@spboucher.ai3// Project: chat.spboucher.ai45// Generation state resync — lets a client that lost its stream recover.67import { NextResponse, type NextRequest } from "next/server";8import { requireSession } from "@/lib/auth/guard";9import { generationState } from "@/lib/generate";10import { getMessage } from "@/lib/conversations";1112export const runtime = "nodejs";1314type Params = { params: Promise<{ id: string }> };1516export async function GET(_req: NextRequest, { params }: Params) {17  const { unauthorized } = await requireSession();18  if (unauthorized) return unauthorized;19  const { id } = await params;20  const gen = generationState(id);21  if (!gen) return NextResponse.json({ error: "Generation not found." }, { status: 404 });22  const message = getMessage(gen.message_id);23  return NextResponse.json({ generation: gen, message });24}25